﻿// -----------------------------------------------------------------------------
// Generate By Furion Tools v2.16.0                            
// -----------------------------------------------------------------------------

using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using HOPU.OnlineSchool.Core;

namespace HOPU.OnlineSchool.Core
{
    public partial class TPayLog : IEntity<MasterDbContextLocator>, IEntityTypeBuilder<TPayLog, MasterDbContextLocator>
    {
    
        public string Id { get; set; }
        public string OrderNo { get; set; }
        public DateTime? PayTime { get; set; }
        public decimal? TotalFee { get; set; }
        public string TransactionId { get; set; }
        public string TradeState { get; set; }
        public byte PayType { get; set; }
        public string Attr { get; set; }
        public byte IsDeleted { get; set; }
        public DateTime GmtCreate { get; set; }
        public DateTime GmtModified { get; set; }
    
        public void Configure(EntityTypeBuilder<TPayLog> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
                entityBuilder.ToTable("t_pay_log");

                entityBuilder.HasComment("支付日志表");

                entityBuilder.HasIndex(e => e.OrderNo, "uk_order_no")
                    .IsUnique();

                entityBuilder.Property(e => e.Id)
                    .HasMaxLength(19)
                    .HasColumnName("id")
                    .HasDefaultValueSql("''")
                    .IsFixedLength(true);

                entityBuilder.Property(e => e.Attr)
                    .HasColumnName("attr")
                    .HasComment("其他属性");

                entityBuilder.Property(e => e.GmtCreate)
                    .HasColumnName("gmt_create")
                    .HasComment("创建时间");

                entityBuilder.Property(e => e.GmtModified)
                    .HasColumnName("gmt_modified")
                    .HasComment("更新时间");

                entityBuilder.Property(e => e.IsDeleted)
                    .HasColumnName("is_deleted")
                    .HasComment("逻辑删除 1（true）已删除， 0（false）未删除");

                entityBuilder.Property(e => e.OrderNo)
                    .IsRequired()
                    .HasMaxLength(20)
                    .HasColumnName("order_no")
                    .HasDefaultValueSql("''")
                    .HasComment("订单号");

                entityBuilder.Property(e => e.PayTime)
                    .HasColumnName("pay_time")
                    .HasComment("支付完成时间");

                entityBuilder.Property(e => e.PayType)
                    .HasColumnType("tinyint")
                    .HasColumnName("pay_type")
                    .HasComment("支付类型（1：微信 2：支付宝）");

                entityBuilder.Property(e => e.TotalFee)
                    .HasColumnType("decimal(10,2)")
                    .HasColumnName("total_fee")
                    .HasDefaultValueSql("'0.01'")
                    .HasComment("支付金额（分）");

                entityBuilder.Property(e => e.TradeState)
                    .HasMaxLength(20)
                    .HasColumnName("trade_state")
                    .IsFixedLength(true)
                    .HasComment("交易状态");

                entityBuilder.Property(e => e.TransactionId)
                    .HasMaxLength(30)
                    .HasColumnName("transaction_id")
                    .HasComment("交易流水号");
        }

    }
}
